package com.serviceprovider.business.module.order.model;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.order.valueobjects.OrderStatusVO;
import com.serviceprovider.business.module.sp.transaction.valueobjects.TransactionDetailsVO;

import org.apache.commons.collections.FactoryUtils;
import org.apache.commons.collections.list.LazyList;

//~--- JDK imports ------------------------------------------------------------

import java.util.ArrayList;
import java.util.List;

public class OrderStatusForm {
    @SuppressWarnings("unchecked")
    private List<OrderStatusVO> orderStatusList = LazyList.decorate(new ArrayList<TransactionDetailsVO>(),
                                                      FactoryUtils.instantiateFactory(OrderStatusVO.class));
    private OrderStatusVO newOrderStatus = new OrderStatusVO();

    public List<OrderStatusVO> getOrderStatusList() {
        return orderStatusList;
    }

    public void setOrderStatusList(List<OrderStatusVO> orderStatusList) {
        this.orderStatusList = orderStatusList;
    }

    public OrderStatusVO getNewOrderStatus() {
        return newOrderStatus;
    }

    public void setNewOrderStatus(OrderStatusVO newOrderStatus) {
        this.newOrderStatus = newOrderStatus;
    }

    public List<OrderStatusVO> getCheckedStatuses() {
        List<OrderStatusVO> result = new ArrayList<OrderStatusVO>();

        for (OrderStatusVO item : orderStatusList) {
            if (item.isChecked()) {
                result.add(item);
            }
        }

        return result;
    }
}



